/*!
 * Header file correcponding to the new database form designer.
 * @author Mazzer Yannis, Calingarayar Martial
 */
#ifndef _NEWDB_H
#define _NEWDB_H

#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QComboBox>
#include <QtGui/QDialog>
#include <QtGui/QDialogButtonBox>
#include <QtGui/QFrame>
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
#include <QSpinBox>
#include <QtGui/QTextEdit>
#include "../../liteconnector/liteconnector.h"

QT_BEGIN_NAMESPACE
class QDialog;
QT_END_NAMESPACE

/*!
 * The newdbDialog gathers all informations about the new database form.
 */
class newdbDialog: public QDialog
{
	Q_OBJECT
public:

/*!
 * This the main constructor of the newdbDialog class
 * @param parent A pointer to the parent which called the constructor.
 */
	newdbDialog(QWidget *parent = 0);

/*!
 * This overload of the main constructor is provided for convenience, it
 * generates a new database dialog from another already filled one.
 * @param dialog
 * @param parent A pointer to the parent which called the constructor.
 */
	newdbDialog(newdbDialog *dialog, QWidget *parent = 0);

/*!
 * This overload of the main constructor is provided for convenience, it
 * generates a new database dialog from the value passed as arguments.
 * @param type the driver used to connect to the database.
 * @param host the Hostname of the server hosting the database.
 * @param name the name of the database or the file if SQLite.
 * @param port the port to which the database daemon is listening.
 * @param user the login used to connect.
 * @param nick a nickname the user wants to use for the added database.
 * @param comm a comment the user wants to use for the added database.
 * @param parent A pointer to the parent which called the constructor.
 */
	newdbDialog(const QString &type,
		    const QString &host,
		    const QString &name,
		    const QString &port,
		    const QString &user,
		    const QString &nick,
		    const QString &comm,
		    QWidget *parent = 0);

/*!
 * This procedure actually draw the widget and its content, it sets the
 * widgets positions. And finally shows it.
 */
	void draw();

/*!
 * This function establishes the connection to the database using the
 * dbConnector class, passing the arguments given by the user.
 * @return dbConnector a pointer to the newly created database connector.
 */
	dbConnector *setUpDatabase();

/*!
 * This function is an accessor to the Driver parameter of the class.
 * The parameter is actually stored in the corresponging Widget.
 * @return QString the text stored in the widget.
 */
	QString getDriver();

/*!
 * This function is an accessor to the Host parameter of the class.
 * The parameter is actually stored in the corresponging Widget.
 * @return QString the text stored in the widget.
 */
	QString getHost();

/*!
 * This function is an accessor to the Name parameter of the class.
 * The parameter is actually stored in the corresponging Widget.
 * @return QString the text stored in the widget.
 */
	QString getName();

/*!
 * This function is an accessor to the Port parameter of the class.
 * The parameter is actually stored in the corresponging Widget.
 * @return QString the text stored in the widget.
 */
	QString getPort();

/*!
 * This function is an accessor to the User parameter of the class.
 * The parameter is actually stored in the corresponging Widget.
 * @return QString the text stored in the widget.
 */
	QString getUser();

/*!
 * This function is an accessor to the Nick parameter of the class.
 * The parameter is actually stored in the corresponging Widget.
 * @return QString the text stored in the widget.
 */
	QString getNick();

/*!
 * This function is an accessor to the Comment parameter of the class.
 * The parameter is actually stored in the corresponging Widget.
 * @return QString the text stored in the widget.
 */
	QString getComment();

private slots:
/*!
 * This slot is used to change the port value to the default port of the
 * corresponding database type selected by the user.
 * @param dbType the type of the database chosen by the user.
 */
	void changePort(QString dbType);

private:
	QDialogButtonBox *buttonBox;
	QComboBox *dbTypeBox;
	QLineEdit *dbHostLineEdit;
	QLineEdit *dbNameLineEdit;
	QSpinBox *dbPortLineEdit;
	QLineEdit *dbUserLineEdit;
	QLineEdit *dbPassLineEdit;
	QLabel *dbTypeLabel;
	QLabel *dbHostLabel;
	QLabel *dbNameLabel;
	QLabel *dbPortLabel;
	QLabel *dbUserLabel;
	QLabel *dbPassLabel;
	QFrame *line;
	QFrame *line_2;
	QFrame *line_3;
	QFrame *line_4;
	QFrame *line_5;
	QFrame *line_6;
	QFrame *line_7;
	QLabel *dbCommentLabel;
	QTextEdit *dbCommentTextEdit;
	QFrame *line_8;
	QLineEdit *dbNickLineEdit;
	QLabel *dbNickLabel;
	QFrame *line_9;
	QTextEdit *InfoTextEdit;
	QLabel *InfoLabel;
	newdbDialog *dialog;

};
#endif
